Repository navigation
fix(shell): support hyphenated tool names - #10961
Conversation
📝 WalkthroughWalkthroughThe change centralizes tool version environment-variable naming and decoding, applies the helpers to shell setup and runtime loading, re-exports the new APIs, updates hook variables to shared constants, and adds unit and end-to-end coverage for hyphenated tool names. ChangesTool environment variable handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant E2ECLI
participant ShellCLI
participant ToolsetBuilder
participant ToolEnvHelpers
E2ECLI->>ShellCLI: install and activate hyphen-tool
ShellCLI->>ToolEnvHelpers: construct tool environment variable name
ToolEnvHelpers-->>ShellCLI: MISE_HYPHEN_TOOL_VERSION
ShellCLI->>ToolsetBuilder: load shell environment
ToolsetBuilder->>ToolEnvHelpers: decode tool environment variable
ToolEnvHelpers-->>ToolsetBuilder: hyphen-tool
ToolsetBuilder-->>E2ECLI: load environment-sourced tool request
E2ECLI->>ShellCLI: unset hyphen-tool
ShellCLI-->>E2ECLI: clear MISE_HYPHEN_TOOL_VERSION
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes
Confidence Score: 5/5Safe to merge — targeted bug fix with a correct round-trip codec, no existing callers broken, both unit and e2e tests validate the new behavior. The encode/decode pair is a proper round-trip for hyphenated and aliased tool names. MISE_VERSION exclusion is handled correctly via strip_suffix. The centralization removes the divergent code paths that caused the original bug. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "refactor(env): centralize internal versi..." | Re-trigger Greptile |
Summary
Root cause
mise shell encoded hyphenated names with shouty snake case, so ls-lint became MISE_LS_LINT_VERSION. Both environment-loading paths decoded the fragment by lowercasing it, reconstructing ls_lint instead of ls-lint. The duplicated decoding logic also allowed those paths to drift.
The mapping intentionally treats hyphens and underscores as equivalent because shell variable names cannot distinguish them. The canonical decoded tool name is kebab-case.
Impact
A tool such as ls-lint installed through mise shell remains active after the next hook-env refresh, repeated mise shell calls succeed, and mise shell --unset removes the matching session selection.
Addresses #7240
Validation
Summary by CodeRabbit
currentlistings, plus verification of environment cleanup.